<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width,  user-scalable=no">

    <title>GMFM粗大运动功能评估</title>

    <style>
        /*.table-a table{border:1px solid #000000}*/

        /*td{*/
        /*vertical-align: bottom;*/
        /*}*/

        #table_guage {
            width: 100%;
        }

        #table_guage hr {
            margin: 6.5px auto;
        }

    </style>


</head>

<body>

<form id="gauge_form">
    <div style="font-size: 16px;height: 26px;/*margin-bottom: 26px;*/"
         class="no-print">
        <table width="100%">
            <tr>
                <td align="left">
                    <label class="print-font16">评定内容</label>
                </td>

                <td align="right">
                    <table class="edit-page hide no-print">
                        <tr>
                            <td><label class="print-font16">快速评测:</label></td>
                            <td style="padding-bottom: 10px">
                                <select id="select_fast_eval" onchange="fastEval();" style="font-size: 13px; padding: 0;height: 22px;width: 80px" class="form-control">
                                    <option value="0">请选择</option>
                                    <option value="1">均是0分</option>
                                    <option value="2">均是3分</option>
                                </select>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    <div style="height: 2px;border-bottom: 1px solid #d0d0d0;"/>
    <div class="hide">
        <table border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td align="left" width="80px"><label style="font-size: 13px">陪同者</label></td>
                <td align="left"><input type="text" class="form-control" style="width: 200px" id="text_companion"/>
                </td>
            </tr>
        </table>

    </div>

    <!--<div class="view-page hide">-->
    <!--<table border="0" cellspacing="0" cellpadding="0">-->
    <!--<tr>-->
    <!--<td align="left" width="80px"><label style="font-size: 18px">陪同者</label></td>-->
    <!--<td align="left"><label id="span_companion" style="font-weight:normal;font-size: 18px"></label></td>-->
    <!--</tr>-->
    <!--</table>-->
    <!--</div>-->

    <!--<table id="table_total" class="table table-bordered view-page hide"-->
    <!--style="margin-top: 20px;font-size:13px;border:1px solid #e7e7e7;" border="1" cellspacing="0" cellpadding="0">-->
    <!--<thead>-->
    <!--<tr>-->
    <!--<td width="40%" align="center"><label>系统计分</label></td>-->
    <!--<td width="30%" align="center"><label>百分比(%)</label></td>-->
    <!--<td width="30%" align="center"><label>目标区得分</label></td>-->
    <!--</tr>-->
    <!--</thead>-->
    <!--<tr>-->
    <!--<td width="40%" align="center">卧位与翻身</td>-->
    <!--<td width="30%" align="center"><span class="span-ratio-1"></span></td>-->
    <!--<td width="30%" align="center"><span class="span-score-1"></span></td>-->
    <!--</tr>-->
    <!--<tr>-->
    <!--<td width="40%" align="center">坐位</td>-->
    <!--<td width="30%" align="center"><span class="span-ratio-2"></span></td>-->
    <!--<td width="30%" align="center"><span class="span-score-2"></span></td>-->
    <!--</tr>-->
    <!--<tr>-->
    <!--<td width="40%" align="center">爬与跪</td>-->
    <!--<td width="30%" align="center"><span class="span-ratio-3"></span></td>-->
    <!--<td width="30%" align="center"><span class="span-score-3"></span></td>-->
    <!--</tr>-->
    <!--<tr>-->
    <!--<td width="40%" align="center">站立位</td>-->
    <!--<td width="30%" align="center"><span class="span-ratio-4"></span></td>-->
    <!--<td width="30%" align="center"><span class="span-score-4"></span></td>-->
    <!--</tr>-->
    <!--<tr>-->
    <!--<td width="40%" align="center">行走、跑、跳</td>-->
    <!--<td width="30%" align="center"><span class="span-ratio-5"></span></td>-->
    <!--<td width="30%" align="center"><span class="span-score-5"></span></td>-->
    <!--</tr>-->
    <!--<tr>-->
    <!--<td width="40%" align="center">总百分比</td>-->
    <!--<td width="30%" align="center"><span class="span-ratio-6"></span></td>-->
    <!--<td width="30%" align="center" style="background-color: #e0e0e0"><span class="span-score-6"></span></td>-->
    <!--</tr>-->
    <!--</table>-->


    <div class="table-a no-print">
        <table id="table_guage" border="0" cellspacing="0" cellpadding="0">
        </table>
    </div>

    <div id="print_area">
        <div style="font-size: 16px;height: 26px;margin-top:26px;margin-bottom: 26px;border-bottom: 1px solid #d0d0d0;">
            <label class="print-font16">评定结果</label>
        </div>
        <table id="table_total_edit" class="table table-bordered "
               style="width: 100%;margin-top: 13px;font-size: 13px"
               border="1" cellspacing="0" cellpadding="0">
            <thead>
            <tr>
                <td width="40%" align="center"><label>系统计分</label></td>
                <td width="30%" align="center"><label>百分比(%)</label></td>
                <td width="30%" align="center"><label>目标区得分</label></td>
            </tr>
            </thead>
            <tr>
                <td width="40%" align="center">卧位与翻身</td>
                <td width="30%" align="center"><span class="span-ratio-1"></span></td>
                <td width="30%" align="center"><span class="span-score-1"></span></td>
            </tr>
            <tr>
                <td width="40%" align="center">坐位</td>
                <td width="30%" align="center"><span class="span-ratio-2"></span></td>
                <td width="30%" align="center"><span class="span-score-2"></span></td>
            </tr>
            <tr>
                <td width="40%" align="center">爬与跪</td>
                <td width="30%" align="center"><span class="span-ratio-3"></span></td>
                <td width="30%" align="center"><span class="span-score-3"></span></td>
            </tr>
            <tr>
                <td width="40%" align="center">站立位</td>
                <td width="30%" align="center"><span class="span-ratio-4"></span></td>
                <td width="30%" align="center"><span class="span-score-4"></span></td>
            </tr>
            <tr>
                <td width="40%" align="center">行走、跑、跳</td>
                <td width="30%" align="center"><span class="span-ratio-5"></span></td>
                <td width="30%" align="center"><span class="span-score-5"></span></td>
            </tr>
            <tr>
                <td width="40%" align="center">总百分比</td>
                <td width="30%" align="center"><span class="span-ratio-6"></span></td>
                <td width="30%" align="center" style="background-color: #e0e0e0"><span class="span-score-6"></span>
                </td>
            </tr>
        </table>
    </div>

    <div class="edit-page hide" style="margin-top: 20px">
        <div class="col-sm-8 col-sm-offset-4">
            <button class="btn btn-white col-sm-3" type="button" onclick="myReset()">重置</button>
            <button class="btn btn-primary col-sm-3 col-sm-offset-1" onclick="submitGaugeResult()" type="button">提交
            </button>
        </div>
    </div>
</form>
</body>

<script>

    var tableTotalEdit = $("#table_total_edit");
    var tableTotal = $("#table_total");

    var editPage = $(".edit-page");
    var viewPage = $(".view-page");

    var textCompanion = $("#text_companion");
    var spanCompanion = $("#span_companion");

    var lyingPositionAndStandUpRatio = 0;
    var lyingPositionAndStandUpScore = 0;
    var sitRatio = 0;
    var sitScore = 0;
    var crawlingAndKneelingRatio = 0;
    var crawlingAndKneelingScore = 0;
    var standRatio = 0;
    var standScore = 0;
    var walkRunJumpRatio = 0;
    var walkRunJumpScore = 0;

    var totalRatio = 0;
    var totalScore = 0;

    var gauge_groups = ['卧位与翻身', '坐位', '爬与跪', '站立位', '行走、跑、跳'];

    var gauge_options = [
        ['仰卧位：头正中位：在四肢保持对称的情况下旋转头部', '仰卧位：双手纠正到中位，手指相接触', '仰卧位：抬头45度', '仰卧位：右侧髋、膝关节能在全关节范围内屈曲', '仰卧位：左侧髋、膝关节能在全关节范围内屈曲', '仰卧位：右上肢过中线抓玩具', '仰卧位：左上肢过中线抓玩具', '仰卧位：向右翻身成俯卧位', '仰卧位：向左翻身成俯卧位', '仰卧位：竖直抬头', '肘支撑成俯卧位：头抬高，肘部伸展，胸部离开床面', '肘支撑俯卧位：右肘支撑躯体，朝前完全伸展左臂', '肘支撑俯卧位：左肘支撑躯体，朝前完全伸展左臂', '俯卧位：向右翻身成仰卧位', '俯卧位：向左翻身成仰卧位', '俯卧位：使用四肢向右侧旋转90度', '俯卧位：使用四肢向左侧旋转90度']
        ,
        ['仰卧位：检查者握孩子双手，拉自己到坐位，头部控制好 (头与脊柱成直线或稍向前倾)', '仰卧位：向右侧翻身，坐起', '仰卧位：向左侧翻身，坐起', '坐于垫子上：检查者支撑孩子胸部，头部竖直保持', '坐于垫子上：检查者支撑孩子胸部，头正中位保持 10秒 ', '用上肢支撑坐于垫子上，保持5秒 ', '坐在垫子上：没有上肢支撑保持坐位 3秒 ', '坐于垫子上：前面放置小玩具，身体前倾触摸玩具，没有上肢支持返回直立坐位 ', '坐于垫子上：触摸右后方45度放置的玩具，返回开始姿势 ', '坐于垫子上：触摸左后方45度放置的玩具，返回开始姿势 ', '右侧横坐：没有上肢支持保持5秒 ', '左侧横坐：没有上肢支持保持5秒 ', '坐于垫子上：有控制地降低身体成俯卧位 ', '足向前坐于垫子上：身体向右侧旋转成四点支撑位 ', '足向前坐于垫子上：身体向左侧旋转成四点支撑位 ', '坐于垫子上：不用上肢帮助旋转 ', '坐于凳上：上肢及双足不支撑保持 10秒 ', '站立位：落坐小凳子 ', '从地面：坐落小凳子 ', '从地面：落坐大椅子']
        ,
        ['俯卧位：向前方腹爬1.8米 ', '四点支持位：用手与膝支撑身体 10秒 ', '四点位：不用上肢支撑成坐位 ', '俯卧位：成四点位，手和膝承重 ', '四点位：右上肢向前伸出，手的位置高于肩部 ', '四点位：左上肢向前伸出，手的位置高于肩部 ', '四点位：向前四点爬或蛙跳 1.8米 ', '四点位：向前四点交替性四点爬 1.8米 ', '四点位：用手和膝 /脚爬上四级台阶 ', '四点位：用手和膝 /脚退着爬下四级台阶 ', '坐垫子上：先使用上肢帮助孩子成高跪位，然后不用上肢支撑保持 10秒 ', '高跪位：先使用上肢帮助成右膝半跪位，然后不用上肢支撑保持 10秒 ', '高跪位：先使用上肢帮助成左膝半跪位，然后不用上肢支撑保持 10秒 ', '高跪位：不用上肢支撑向前跪走 10步']
        ,
        ['地面：抓着大凳子拉自己站起 ', '站立：不用上肢支持保持 3秒 ', '站立：单手抓住大凳子，抬起右脚，保持 3秒 ', '站立：单手抓住大凳子，抬起左脚，保持 3秒 ', '站立：不用上肢支持保持 20秒 ', '站立：抬起左脚，不用上肢支持保持 10秒 ', '站立：抬起右脚，不用上肢支持保持 10秒 ', '坐在小凳子上：不用上肢帮助站起 ', '高跪位：通过右侧半跪位站起，不用上肢帮助 ', '高跪位:通过左侧半跪位站起 ,不用上肢帮助 ', '站立位:有控制地降低身体坐到地面,不用上肢的帮助 ', '站立位：成蹲位，不用上肢帮助 ', '站立位：不用上肢的帮助 ,从地面拾物再返回成站立位 ']
        ,
        ['站立：两手扶大长凳，向右侧横走 5步 ', '站立：两手扶大长凳，向左侧横走 5步 ', '站立：牵两手向前走 10步 ', '站立：牵单手向前走 10步 ', '站立：向前走 10步 ', '站立：向前走 10步，停止，转 180度，返回 ', '站立：后退10步 ', '站立：两手提大物向前走 10步 ', '站立：在 20厘米间隔的平行线之间连续向前走 10步 ', '站立：在2厘米宽的直线上连续向前走10步 ', '站立：右脚领先跨越膝盖高度的木棒 ', '站立：左脚领先跨越膝盖高度的木棒 ', '站立：跑 4.5米，停止，返回 ', '站立：右脚踢球 ', '站立：左脚踢球 ', '站立：两脚同时跳高 30厘米 ', '站立：两脚同时跳远 30厘米 ', '右脚单立：60厘米直径的圆内，右脚跳 10次 ', '左脚单立：60厘米直径的圆内，左脚跳 10次 ', '扶一侧栏杆站立：上四级台阶，扶栏杆交替步 ', '站立，抓着扶手：下四级台阶，抓一侧扶手，交替出步 ', '站立：上四级台阶，交替出步 ', '站立：下四级台阶，交替出步 ', '站在 15厘米高的台阶上：两足同时跳下 ']
    ];


    /**
     * 用于标记哪些题目要标星
     * @type {number[]}
     */
    var starIndexArray = [2, 6, 7, 10, 18, 21, 22, 23, 24, 25, 26, 27, 30, 31, 32, 34, 35, 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 48, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88];


    builder();

    //    initPage();
    //
    //    function initPage() {
    //        if(editable==true||editable=='true') {
    //            builder(true);
    ////            tableTotalEdit.removeClass('hide');
    //            editPage.removeClass('hide');
    //        }else{
    //            builder(false);
    //
    //            viewPage.removeClass('hide');
    //            mandy_get_gauge_record(gaugeRecordId,prcpItemId,function (data) {
    //                debugAlert(data.result);
    //                var result=eval('('+data.result+')');
    //
    //                for (var i = 0; i < gauge_groups.length; i++) {
    //                    for (var j = 0; j < gauge_options[i].length; j++) {
    //                        var questions=result.questions;
    //                        for(var k=0;k<questions.length;k++){
    //                            if(questions[k].key.trim()==gauge_options[i][j].trim()){
    //                                $("input[name='radio_" + i + "_" + j + "']:eq("+questions[k].value+")").attr("checked",'checked');
    //                            }
    //                        }
    //                    }
    //                }
    //
    //                $(".span-ratio-1").text(result.lying_position_and_stand_up_ratio);
    //                $(".span-ratio-2").text(result.sit_ratio);
    //                $(".span-ratio-3").text(result.crawling_and_kneeling_ratio);
    //                $(".span-ratio-4").text(result.stand_ratio);
    //                $(".span-ratio-5").text(result.walk_run_jump_ratio);
    //
    //                $(".span-score-1").text(result.lying_position_and_stand_up_score);
    //                $(".span-score-2").text(result.sit_score);
    //                $(".span-score-3").text(result.crawling_and_kneeling_score);
    //                $(".span-score-4").text(result.stand_score);
    //                $(".span-score-5").text(result.walk_run_jump_score);
    //
    //
    //                $(".span-ratio-6").text(result.total_ratio);
    //                $(".span-score-6").text(result.total_score);
    //
    //                spanCompanion.text(result.companion);
    //
    //            });
    //        }
    //    }

    function builder() {
        var index = 1;

        for (var i = 0; i < gauge_groups.length; i++) {
            for (var j = 0; j < gauge_options[i].length; j++) {

                if (j == 0) {
                    //添加组标题
                    var groupTr =
                        "<tr><td  height='30px'></td></tr>" +
                        "<tr><td align='left' ><label style='font-size: 14px'>" + gauge_groups[i] + "</label></td></tr>";
                    $("#table_guage").append(groupTr);
                }


                var radio = '<table width="100%"  border="0" cellspacing="0" cellpadding="0">' +
                    '<tr>' +
                    '<td  width="25%" align="left"><input type="radio" value="0"  class="question-radio min" onchange="changeSelect()" name="radio_' + i + '_' + j + '"/>0</label></td>' +
                    '<td  width="25%" align="left"><input type="radio" value="1"  class="question-radio" onchange="changeSelect()" name="radio_' + i + '_' + j + '"/>1</label></td>' +
                    '<td  width="25%" align="left"><input type="radio" value="2"  class="question-radio" onchange="changeSelect()" name="radio_' + i + '_' + j + '"/>2</label></td>' +
                    '<td  width="25%" align="left"><input type="radio" value="3"  class="question-radio max" onchange="changeSelect()" name="radio_' + i + '_' + j + '"/>3</label></td>' +
                    '</tr></table>';


                var starLi = '';

                if (starIndexArray.indexOf(index) > -1) {
                    starLi = '<i class="fa fa-star"/>';
                }

                var selectTr = "<tr >" +
                    "<td style='font-size:13px;padding-left:25px' id='td_" + i + "_" + j + "'>" + (index++) + starLi + " ．" + gauge_options[i][j].trim() + "</td>" +
                    "</tr>" +
                    "<tr><td style='padding-left: 5vw' id='td_select_" + i + "_" + j + "'>" +
                    "</td></tr>" +
                    "<tr><td height='15px'><hr style='height:1px;border:none;border-top:1px dashed #d0d0d0;'/></td></tr>";

                $("#table_guage").append(selectTr);
                $("#td_select_" + i + "_" + j).append(radio);
            }
        }

    }

    function changeSelect() {

        lyingPositionAndStandUpRatio = 0;
        lyingPositionAndStandUpScore = 0;
        sitRatio = 0;
        sitScore = 0;
        crawlingAndKneelingRatio = 0;
        crawlingAndKneelingScore = 0;
        standRatio = 0;
        standScore = 0;
        walkRunJumpRatio = 0;
        walkRunJumpScore = 0;

        for (var i = 0; i < gauge_groups.length; i++) {
            for (var j = 0; j < gauge_options[i].length; j++) {
//                var value=$("#select_" + i + "_" + j).val();
                var value = $("input[name='radio_" + i + "_" + j + "']:checked").val();
                if (typeof(value) == "undefined") {
                    value = 0;
                }
                if (i == 0) {
                    lyingPositionAndStandUpScore += parseInt(value);
                } else if (i == 1) {
                    sitScore += parseInt(value);
                } else if (i == 2) {
                    crawlingAndKneelingScore += parseInt(value);
                } else if (i == 3) {
                    standScore += parseInt(value);
                } else if (i == 4) {
                    walkRunJumpScore += parseInt(value);
                }
            }
        }

        lyingPositionAndStandUpRatio = parseFloat((lyingPositionAndStandUpScore / 51 * 100).toFixed(2));
        sitRatio = parseFloat((sitScore / 60 * 100).toFixed(2));
        crawlingAndKneelingRatio = parseFloat((crawlingAndKneelingScore / 42 * 100).toFixed(2));
        standRatio = parseFloat((standScore / 39 * 100).toFixed(2));
        walkRunJumpRatio = parseFloat((walkRunJumpScore / 72 * 100).toFixed(2));

        $(".span-ratio-1").text(lyingPositionAndStandUpRatio);
        $(".span-ratio-2").text(sitRatio);
        $(".span-ratio-3").text(crawlingAndKneelingRatio);
        $(".span-ratio-4").text(standRatio);
        $(".span-ratio-5").text(walkRunJumpRatio);

        $(".span-score-1").text(lyingPositionAndStandUpScore);
        $(".span-score-2").text(sitScore);
        $(".span-score-3").text(crawlingAndKneelingScore);
        $(".span-score-4").text(standScore);
        $(".span-score-5").text(walkRunJumpScore);

        totalRatio = ((lyingPositionAndStandUpRatio + sitRatio + crawlingAndKneelingRatio + standRatio + walkRunJumpRatio) / 5).toFixed(2);
        totalScore = lyingPositionAndStandUpScore + sitScore + crawlingAndKneelingScore + standScore + walkRunJumpScore;

        $(".span-ratio-6").text(totalRatio);
//        $(".span-score-6").text((totalScore/5).toFixed(2));
    }

    //    function submit(){
    //        changeSelect();
    //        var gauge={};
    //
    //        gauge.lying_position_and_stand_up_ratio=lyingPositionAndStandUpRatio;
    //        gauge.lying_position_and_stand_up_score=lyingPositionAndStandUpScore;
    //        gauge.sit_ratio=sitRatio;
    //        gauge.sit_score=sitScore;
    //        gauge.crawling_and_kneeling_ratio=crawlingAndKneelingRatio;
    //        gauge.crawling_and_kneeling_score=crawlingAndKneelingScore;
    //        gauge.stand_ratio=standRatio;
    //        gauge.stand_score=standScore;
    //        gauge.walk_run_jump_ratio=walkRunJumpRatio;
    //        gauge.walk_run_jump_score=walkRunJumpScore;
    //        gauge.total_ratio=totalRatio;
    //        gauge.total_score=totalScore;
    //
    //        var questions=[];
    //
    //        var index=0;
    //
    //        for (var i = 0; i < gauge_groups.length; i++) {
    //            for (var j = 0; j < gauge_options[i].length; j++) {
    //                var questionKey=$("#td_" + i + "_" + j).html();
    //                questionKey=questionKey.split("．")[1].trim();
    //
    ////                var result=$("#select_" + i + "_" + j).val();
    //                var result=$("input[name='radio_" + i + "_" + j+"']:checked").val();
    //                if(typeof(result) == "undefined"){
    //                    result=0;
    //                }
    //                var question={};
    //                question.key=questionKey;
    //                question.value=result;
    //                questions[index++]=question;
    //            }
    //        }
    //
    //        gauge.questions=questions;
    //
    //        gauge.companion=textCompanion.val();
    //
    //        debugAlert(gauge);
    //
    //        mandy_post_gauge_record_result(gaugeRecordId, JSON.stringify(gauge), function (data) {
    //            debugAlert(data);
    //            utils.msgSuccess("提交成功");
    //        });
    //    }


    function setEditable(edit) {
        editPage.removeClass('hide');
        if (edit == true || edit == 'true') {
//            editPage.removeClass('hide');
//            viewPage.addClass('hide');
        } else {
//            mandy_get_gauge_record(gaugeRecordId,prcpItemId,function (data) {
//                debugAlert(data.result);
//                var result=eval('('+data.result+')');
//
//                for (var i = 0; i < gauge_groups.length; i++) {
//                    for (var j = 0; j < gauge_options[i].length; j++) {
//                        var questions=result.questions;
//                        for(var k=0;k<questions.length;k++){
//                            if(questions[k].key.trim()==gauge_options[i][j].trim()){
//                                $("input[name='radio_" + i + "_" + j + "']:eq("+questions[k].value+")").attr("checked",'checked');
//                            }
//                        }
//                    }
//                }
//
//                $(".span-ratio-1").text(result.lying_position_and_stand_up_ratio);
//                $(".span-ratio-2").text(result.sit_ratio);
//                $(".span-ratio-3").text(result.crawling_and_kneeling_ratio);
//                $(".span-ratio-4").text(result.stand_ratio);
//                $(".span-ratio-5").text(result.walk_run_jump_ratio);
//
//                $(".span-score-1").text(result.lying_position_and_stand_up_score);
//                $(".span-score-2").text(result.sit_score);
//                $(".span-score-3").text(result.crawling_and_kneeling_score);
//                $(".span-score-4").text(result.stand_score);
//                $(".span-score-5").text(result.walk_run_jump_score);
//
//
//                $(".span-ratio-6").text(result.total_ratio);
//                $(".span-score-6").text(result.total_score);
//
//                spanCompanion.text(result.companion);
//
//            });
            textCompanion.attr("disabled", true);
            viewPage.removeClass('hide');
            editPage.addClass('hide');
            $(".question-radio").attr('disabled', 'disabled');
        }

    }

    function setGaugeResult(result) {
        for (var i = 0; i < gauge_groups.length; i++) {
            for (var j = 0; j < gauge_options[i].length; j++) {
                var questions = result.questions;
                for (var k = 0; k < questions.length; k++) {

                    if (gauge_options[i][j].trim().indexOf('肘支撑成俯卧位') > 0 && questions[k].key.trim().indexOf('肘支撑成俯卧位') > 0) {
                        alert(questions[k].key.trim() == gauge_options[i][j].trim());
                        questions[k].key.trim() + "__" + gauge_options[i][j].trim()
                    }
                    if (questions[k].key.trim() == gauge_options[i][j].trim()) {
                        $("input[name='radio_" + i + "_" + j + "'][value=" + questions[k].value + "]").attr("checked", 'checked');
                    }
                }
            }
        }

        $(".span-ratio-1").text(result.lying_position_and_stand_up_ratio);
        $(".span-ratio-2").text(result.sit_ratio);
        $(".span-ratio-3").text(result.crawling_and_kneeling_ratio);
        $(".span-ratio-4").text(result.stand_ratio);
        $(".span-ratio-5").text(result.walk_run_jump_ratio);

        $(".span-score-1").text(result.lying_position_and_stand_up_score);
        $(".span-score-2").text(result.sit_score);
        $(".span-score-3").text(result.crawling_and_kneeling_score);
        $(".span-score-4").text(result.stand_score);
        $(".span-score-5").text(result.walk_run_jump_score);


        $(".span-ratio-6").text(result.total_ratio);
//        $(".span-score-6").text(result.total_score);

//        spanCompanion.text(result.companion);
        textCompanion.val(result.companion);
    }

    function getGaugeResult() {
        changeSelect();
        var gauge = {};

        gauge.lying_position_and_stand_up_ratio = lyingPositionAndStandUpRatio;
        gauge.lying_position_and_stand_up_score = lyingPositionAndStandUpScore;
        gauge.sit_ratio = sitRatio;
        gauge.sit_score = sitScore;
        gauge.crawling_and_kneeling_ratio = crawlingAndKneelingRatio;
        gauge.crawling_and_kneeling_score = crawlingAndKneelingScore;
        gauge.stand_ratio = standRatio;
        gauge.stand_score = standScore;
        gauge.walk_run_jump_ratio = walkRunJumpRatio;
        gauge.walk_run_jump_score = walkRunJumpScore;
        gauge.total_ratio = totalRatio;
        gauge.total_score = totalScore;

        var questions = [];

        var index = 0;

//        if(textCompanion.val().trim()==null||textCompanion.val().trim()==''){
//            utils.msgError("请填写陪同者!");
//            return;
//        }
        for (var i = 0; i < gauge_groups.length; i++) {
            for (var j = 0; j < gauge_options[i].length; j++) {
                var questionKey = $("#td_" + i + "_" + j).html();
//                questionKey = questionKey.split("．")[1].trim();
                questionKey = questionKey.substring(questionKey.indexOf(" ．") + 2, questionKey.length).trim();

//                var result=$("#select_" + i + "_" + j).val();
                var result = $("input[name='radio_" + i + "_" + j + "']:checked").val();
//                if (typeof(result) == "undefined") {
////                    result=0;
//                    var noCheckedIndex = i * gauge_groups.length + j + 1;
//                    utils.msgError("第" + (index + 1) + "个选项还未评估!");
//                    $("input[name='radio_" + i + "_" + j + "']").focus();
//                    return;
//                }
                var question = {};
                question.key = questionKey;
                question.value = result;
                questions[index++] = question;
            }
        }

        gauge.questions = questions;

        gauge.companion = textCompanion.val().trim();


        debugAlert(gauge);

        return gauge;
    }

    function getCount() {
//        $("#gauge_form")[0].reset();
//        changeSelect();

        $(".span-ratio-1").text(null);
        $(".span-ratio-2").text(null);
        $(".span-ratio-3").text(null);
        $(".span-ratio-4").text(null);
        $(".span-ratio-5").text(null);

        $(".span-score-1").text(null);
        $(".span-score-2").text(null);
        $(".span-score-3").text(null);
        $(".span-score-4").text(null);
        $(".span-score-5").text(null);
        $(".span-ratio-6").text(null);
    }


</script>

</html>
